package com.mud.dnd.domain.dao;

import java.util.Date;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.TransactionAttribute;

import com.mud.dnd.domain.common.DAOException;
import com.mud.dnd.domain.common.QueryParameter;
import com.mud.dnd.domain.model.Action;
import com.mud.dnd.domain.model.Card;
import com.mud.dnd.domain.model.CardAction;
import com.mud.dnd.domain.model.Comment;
import com.mud.dnd.domain.model.Deck;
import com.mud.dnd.domain.model.GameItem;
import com.mud.dnd.domain.model.Session;
import com.mud.dnd.domain.model.User;
import com.mud.dnd.domain.model.User.Role;


@Local
public interface DnDDAO {
	
	@TransactionAttribute
	public abstract GameItem getGameItembyID(int id) throws DAOException;
	
	@TransactionAttribute
	public abstract void updateGameItem(int id, String name, String description,
			String pictureURL, String picturePath, int rate ) throws DAOException;
	
	@TransactionAttribute
	public abstract int getDnDItemOwnerID(int id) throws DAOException;

	@TransactionAttribute
	public abstract List<Card> getCards(List<QueryParameter> params);

	@TransactionAttribute
	public abstract int createCard(String name, String description,
			String pictureURL,String type, int rarity, User author) throws DAOException;
	
	@TransactionAttribute
	public abstract void updateCard(int id, String name, String description,
			String pictureURL,String picturePath, String type, int rate, int rarity) throws DAOException;
	
	@TransactionAttribute
	public abstract void deleteCard(int id) throws DAOException;

	@TransactionAttribute
	public abstract List<Deck> getDecks(List<QueryParameter> params);

	@TransactionAttribute
	public abstract int createDeck(String name, String description,
			String pictureURL, User author);
	
	@TransactionAttribute
	public abstract void updateDeck(int id, String name, String description,
			String pictureURL, String picturePath, int rate ) throws DAOException;
	
	@TransactionAttribute
	public abstract void deleteDeck(int id) throws DAOException ;

	@TransactionAttribute
	public abstract void addCardtoDeck(int cardID, int deckID)
			throws DAOException;
	
	@TransactionAttribute
	public abstract void removeCardfromDeck(int cardID, int deckID)
			throws DAOException;
	
	@TransactionAttribute
	public abstract int createAction(String name, String description,
			String pictureURL, User author) throws DAOException;
	
	@TransactionAttribute
	public abstract List<Action> getActions(List<QueryParameter> params);
	
	@TransactionAttribute
	public abstract List<CardAction> getCardActions(List<QueryParameter> params);
	
	@TransactionAttribute
	public abstract void updateAction(int id, String name, String description,
			String pictureURL, String picturePath, int rate ) throws DAOException;
	
	@TransactionAttribute
	public abstract void deleteAction(int id) throws DAOException ;

	@TransactionAttribute
	public abstract void addActiontoCard(int actionID, int cardID, int amount)
			throws DAOException;
	
	@TransactionAttribute
	public abstract void removeActionfromCard(int actionID, int cardID)
			throws DAOException;
	
	@TransactionAttribute
	public abstract void updateActiononCard(int actionID, int cardID, int amount, int order)
			throws DAOException;

	@TransactionAttribute
	public int createUser(String name, String password, Role role) throws DAOException;

	@TransactionAttribute
	public void deleteUser(int id) throws DAOException;

	@TransactionAttribute
	public User getUserData(String name) throws DAOException;

	@TransactionAttribute
	public List<Session> getSessionParametersforUser(User user) throws DAOException;

	@TransactionAttribute
	public void updateUserSession(User user, String sessionID, Date expDate)
			throws DAOException;
	
	@TransactionAttribute
	public void clearSessionforUser(User user) throws DAOException;

	@TransactionAttribute
	public void deleteSessionsExpsBefore(Date date);

	@TransactionAttribute
	public int createComment(String message, Date creationDate, User author,int gameItemID) throws DAOException;

	
	@TransactionAttribute
	public void deleteComment(int id) throws DAOException;

	@TransactionAttribute
	public List<Comment> getComments(List<QueryParameter> params);

	

	

	



}